from django.shortcuts import render
import re

from context import StudioCtx,AppCtx,CollectionCtx

# Create your views here.
def rout(request,studio_name,content=''):
    s=StudioCtx(studio_name)
    context=s.get_dict()
    if content=='home':
        sub_temp='home.html'
    elif content=='collection':
        collect=CollectionCtx(studio_name)
        context.update( collect.get_dict() )
        sub_temp='collection.html'
    elif content=='contact':
        sub_temp='contact.html'
    elif content =='policy':
        sub_temp='policy.html'
    else:
        
        appCtx = AppCtx(content)
        context.update(appCtx.get_dict())
        context['title']=appCtx.title
        sub_temp=appCtx.orientation+'.html' #'app.html'
    return render(request,'page/{temp}/{sub_temp}'.format(temp=s.temp,sub_temp=sub_temp),context=context)




